<!--
/**************************************************
* @ operatormod.jsp
*
* Copyright   2005 Hitrust Technology Inc.
* Developed by SDC, Hitrust.
* All Rights Reserved.
*
* Modify History:
*  v1.00, 2006/02/14, Jenny Li
*  1) first release
/**************************************************
-->
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ include file="../../common.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!--<link href="<%=root%>/css/css.css" rel="stylesheet" type="text/css">-->
<LINK rel="stylesheet" href="css/caigouxitong.css">
<SCRIPT language="JavaScript" src="<%=root%>/js/common.js"></SCRIPT>
<SCRIPT language="JavaScript" src="<%=root%>/js/hi-check.js"></SCRIPT>
<title>修改操作员</title>
<%
	HashMap tMap = (HashMap)request.getAttribute("Organization2");
	GSOperatorBean tOperBean = (GSOperatorBean)request.getAttribute("GSOperatorBean");
	GSOrganizationBean tUpperOrgBean = (GSOrganizationBean)request.getAttribute("UpperOrganization");
	if(message == null){
%>
<script language="JavaScript">

  function change2(optval){
  		
  		var val = optval;
		if(val=='00'){
			var listbox = document.getElementById("operOrg2");
			listbox.length = 0;
			var option = new Option();
		  	option.text="----二级----";
			option.value = "00";			
			listbox.options[listbox.length] = option;
		}else{
  	<%
  		if(tMap !=null){
	 	   	Collection tCollection = tMap.keySet();
	        Iterator tIterator = tCollection.iterator();
  		       while(tIterator.hasNext()){

  		           String tKey = (String)tIterator.next();
  		           ArrayList tList = (ArrayList)tMap.get(tKey);
  	%>
  				if(val == '<%=tKey%>'){
	  				var counter;
	  				var listbox = document.getElementById("operOrg2");
	  				listbox.length = 0;  		  		  											
	  				 				  											
	<%					
					for(int n=0;n<tList.size();n++){
					    GSOrganizationBean tGSOrganizationBean = (GSOrganizationBean)tList.get(n);
					    String categoryId = tGSOrganizationBean.getGs_org_id();
					    String categoryName = tGSOrganizationBean.getGs_org_name();
	%>				
						var temp1 = '<%=categoryId%>';
						var temp2 = '<%=categoryName%>|<%=categoryId%>';
						var option = new Option();
						option.value = temp1;
						option.text = temp2;
						listbox.options[listbox.length] = option;						
	<%
					}
	%>
  				}
  				
  	<%
  		    }
  		}
  	%>
  	}	
	}
	function process(param){
  	    var iFields1 = new Array(2);
		//iFields1[0] = 'operId||操作员帐号||Y||1-10||##';
        iFields1[0] = 'operName||操作员姓名||Y||1-20||##';
        //iFields1[2] = 'operPwd||操作员密码||Y||4-10||#ABC';
        //iFields1[3] = 'confirmPwd||密码确认||Y||4-10||#ABC';
        iFields1[1] = 'email||电子邮箱||N||1-50||#M';
        var ary = new Array(8);
        if(param == 'M'){
        	if( HiScript.value(operatormodform.name,iFields1) == false)  return false;	
			if(!checkTel(operatormodform.contactTel.value)){
				alert("电话号码只能输入字符：0-9或'-'");
				return false;
			}
        	if(operatormodform.operOrg.value == '00'){
        		alert("请选择操作员所属单位！");
        		return false;
        	}
        	//operatormodform.action="<%= response.encodeURL(request.getContextPath() + "/A400508.do") %>";
	       	//operatormodform.submit();	
	       	ary[0] = operatormodform.operName.value;
	       	ary[1] = operatormodform.operPostion.value;
	       	ary[2] = operatormodform.operSex.value;
	       	ary[3] = operatormodform.contactTel.value;
	       	ary[4] = operatormodform.email.value;	
	       	ary[5] = operatormodform.validity.value;     
	       	ary[6] = operatormodform.operOrg2.value;
	       	ary[7] = operatormodform.operId.value;  		       		       		       	
	       	window.returnValue = ary;	  
	       	window.close();
       	}
	}
	
	function back(){
  
    self.close();
   }
</script>
</head>
<body text="#000000" leftmargin="0" topmargin="0"  marginwidth="0" marginheight="0">

<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td height="20"> 
      <table width="100%" border="0" cellspacing="0" cellpadding="1">
        <tr height="20">
          <td height="20" width="1" class="mtxt_black">&nbsp;</td>
          <td height="30" width="758" class="mtxt_black">操作员管理</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<form name="operatormodform" method="post" > 
<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr> 
		<td> 
			<table class=bg_table id=tableId	cellspacing=1 cellpadding=0 style="padding-left:5;padding-right:5" width=100% align=center border=0>
				<TR height=20>
					<TD class="bg_column" align=center width="20%">操作员帐号</TD>
					<input type="hidden" name="operId" value="<%=tOperBean.getGs_oper_id()%>">
					<TD align=left class="bg_row_odd" width="30%"><%=tOperBean.getGs_oper_id() %></TD>					
					<TD class="bg_column" align=center width="20%">操作员姓名</TD>
					<TD align=left class="bg_row_odd" width="30%"><input type="text" name="operName" maxlength="20" value="<%=tOperBean.getGs_oper_name()%>"></TD>					
				</TR>
<!--				<TR height=20>-->
<!--					<TD class="bg_column" align=center>操作员密码</TD>-->
<!--					<TD align=left class="bg_row_odd"><input type="password" name="operPwd" maxlength="10"></TD>									-->
<!--					<TD class="bg_column" align=center>密码确认</TD>-->
<!--					<TD left=right class="bg_row_odd">-->
<!--						<input type="password" name="confirmPwd" maxlength="10">-->
<!--					</TD>-->
<!--				</TR>-->
				<tr>
					<TD class="bg_column" align=center>操作员职位</TD>
					<TD left=right class="bg_row_odd" >
						<input type="text" name="operPostion" maxlength="50" value="<%=tOperBean.getGs_oper_position() == null? "":tOperBean.getGs_oper_position()%>">
					</TD>					
					<TD class="bg_column" align=center>操作员性别</TD>
					<TD left=right class="bg_row_odd">
					<select name="operSex">
					<%
						if(tOperBean.getGs_oper_sex().equals("0")){
					%>
						<option value="0" selected>男</option>		
						<option value="1">女</option>						
					<%
						}else if(tOperBean.getGs_oper_sex().equals("1")){
					%>								
						<option value="0">男</option>		
						<option value="1" selected>女</option>						
					<%
						}
					%>
				
					</select>
					</TD>					
				</TR>
				<TR height=20>
					<TD class="bg_column" align=center>联系电话</TD>
					<TD left=right class="bg_row_odd">
						<input type="text" name="contactTel" maxlength="50" value="<%=tOperBean.getGs_oper_phone() == null? "":tOperBean.getGs_oper_phone() %>">
					</TD>					
					<TD class="bg_column" align=center>电子邮箱</TD>
					<TD left=right class="bg_row_odd">
						<input type="text" name="email" maxlength="50" value="<%=tOperBean.getGs_oper_email()==null? "":tOperBean.getGs_oper_email() %>">
					</TD>					
				</TR>				
				<TR height=20>
					<TD class="bg_column" align=center>有效性</TD>
					<TD left=right class="bg_row_odd">
						<select name="validity">
						<%
							if(tOperBean.getGs_oper_validity().equals("0")){
						%>
							<option value="0" selected>有效</option>
							<option value="1">无效</option>				
						<%
							}else{
						%>
							<option value="0">有效</option>
							<option value="1"  selected>无效</option>				
						<%
							}
						%>									
						</select>
					</TD>					
					<TD class="bg_column" align=center>所属单位</TD>
					<TD left=right class="bg_row_odd">
				  <select name="operOrg" onChange="change2(this.value)">
				  <option value="00">----一级----</option>
				    <%//获取所有机构代码
					 ArrayList tOraganization = (ArrayList) request.getAttribute("Oraganization");
				     String tOperOrg = request.getParameter("operOrg");
				     String tCurOperOrgId = tOperBean.getGs_oper_org_id();
				     GSOrganizationBean tGSOrganizationBean = null;
					 if (tOraganization != null) {
						for (int n = 0; n < tOraganization.size(); n++) {
						    tGSOrganizationBean = (GSOrganizationBean) tOraganization.get(n);
						    System.out.println("------"+tUpperOrgBean.getGs_org_id());
						    if(tCurOperOrgId.substring(2,4).equals("00") && tCurOperOrgId.equals(tGSOrganizationBean.getGs_org_id())){
					%>
							<option value="<%=tGSOrganizationBean.getGs_org_id()%>" selected>
								<%=tGSOrganizationBean.getGs_org_name()%>|<%=tGSOrganizationBean.getGs_org_id()%>
							</option>
					
					<%		        
						    }else if(tUpperOrgBean != null && tUpperOrgBean.getGs_org_id().equals(tGSOrganizationBean.getGs_org_id())){
					%>
							<option value="<%=tGSOrganizationBean.getGs_org_id()%>" selected>
								<%=tGSOrganizationBean.getGs_org_name()%>|<%=tGSOrganizationBean.getGs_org_id()%>
							</option>

					<%		        
						    }else if(tOperOrg != null && tOperOrg.equals(tGSOrganizationBean.getGs_org_id())){
					%>
							<option value="<%=tGSOrganizationBean.getGs_org_id()%>" selected>
								<%=tGSOrganizationBean.getGs_org_name()%>|<%=tGSOrganizationBean.getGs_org_id()%>
							</option>
					<%
							}else{
					%>			
							<option value="<%=tGSOrganizationBean.getGs_org_id()%>">
								<%=tGSOrganizationBean.getGs_org_name()%>|<%=tGSOrganizationBean.getGs_org_id()%>
							</option>
					<%
							}
						}
					}
					%>
				 </select>
				<select id="operOrg2" name="operOrg2">			
						<%
							String tManufType2 = request.getParameter("operOrg2");
							if(tOperBean != null){
							    System.out.println("====="+tOperBean.getGs_oper_org_id());
							    ArrayList temp = null;
								if(tOperBean.getGs_oper_org_id().substring(2,4).equals("00")){
									temp = (ArrayList)tMap.get(tOperBean.getGs_oper_org_id());    
								}else{
								    temp = (ArrayList)tMap.get(tUpperOrgBean.getGs_org_id());
								}
								for(int i=0; i<temp.size(); i++){
								    GSOrganizationBean tGSManuf2 = (GSOrganizationBean)temp.get(i);
									if(tOperBean.getGs_oper_org_id().equals(tGSManuf2.getGs_org_id())){
						%>
									<option value="<%=tGSManuf2.getGs_org_id()%>" selected><%=tGSManuf2.getGs_org_name()%>|<%=tGSManuf2.getGs_org_id()%></option>													
						<%	 
									}else{
						%>
									<option value="<%=tGSManuf2.getGs_org_id()%>"><%=tGSManuf2.getGs_org_name()%>|<%=tGSManuf2.getGs_org_id()%></option>						
						<%			    
									}
								}
							}	
							else if(tOperOrg != null && !tOperOrg.equals("00")){
							    ArrayList temp = (ArrayList)tMap.get(tOperOrg);
							    if(temp!= null && temp.size() > 0){
									for(int i=0; i<temp.size(); i++){
									    GSOrganizationBean tGSManuf2 = (GSOrganizationBean)temp.get(i);
									    if(tManufType2 != null && tManufType2.equals(tGSManuf2.getGs_org_id())){
							%>
									<option value="<%=tManufType2%>" selected><%=tGSManuf2.getGs_org_name()%>|<%=tGSManuf2.getGs_org_id()%></option>
							<%			        
									    }else{
							%>
									<option value="<%=tGSManuf2.getGs_org_id()%>"><%=tGSManuf2.getGs_org_name()%>|<%=tGSManuf2.getGs_org_id()%></option>
									
							<%			}	
									}
							    }
							}
						%>

						</select>
									
					</TD>					
				</TR>				
			</table>
		</td>
	</tr>
</table>
</form>
    <p align="center">  
<input type="button" value="修改" onClick="process('M')" class="kuang">
<input type="button" value="关闭" onClick="back()" class="kuang">
    </p>

</body>
<%} %>
</html>